package com.souku.finance.application.ui.more;

import android.Manifest;
import android.app.Dialog;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.souku.finance.application.R;
import com.souku.finance.application.base.BaseActivity;
import com.souku.finance.application.dialog.SimpleDialog;

import java.net.URISyntaxException;

import butterknife.OnClick;

/**
 * Created by Android on 2016/12/22.
 */

public class CustomerserviceActivity extends BaseActivity implements View.OnClickListener {

    protected RelativeLayout topBack;
    protected TextView topTitle;
    protected RelativeLayout rlPhone;
    protected RelativeLayout rlXl;
    protected RelativeLayout rlWxgzh;
    protected RelativeLayout rlWxfw;

    @Override
    public void internet() {

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.setContentView(R.layout.act_customerservice);
        initView();
        topTitle.setText("客户服务");

        dialog = new SimpleDialog(this, "确定拨打4008-391-591吗？", new SimpleDialog.OnClick() {
            @Override
            public void ok() {
                Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + "4000-391-591"));
                if (ActivityCompat.checkSelfPermission(CustomerserviceActivity.this, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED)
                    return;
                startActivity(intent);
            }

            @Override
            public void cancel() {
                dialog.dismiss();
            }
        }, true);
    }

    @Override
    public void onClick(View view) {
        if (view.getId() == R.id.top_back) {
            finish();
        } else if (view.getId() == R.id.rl_phone) {
            dialog.show();
        }
    }

    private Dialog dialog;

    private void initView() {
        topBack = (RelativeLayout) findViewById(R.id.top_back);
        topBack.setOnClickListener(CustomerserviceActivity.this);
        topTitle = (TextView) findViewById(R.id.top_title);
        rlPhone = (RelativeLayout) findViewById(R.id.rl_phone);
        rlPhone.setOnClickListener(CustomerserviceActivity.this);
        rlXl = (RelativeLayout) findViewById(R.id.rl_xl);
        rlXl.setOnClickListener(CustomerserviceActivity.this);
        rlWxgzh = (RelativeLayout) findViewById(R.id.rl_wxgzh);
        rlWxgzh.setOnClickListener(CustomerserviceActivity.this);
        rlWxfw = (RelativeLayout) findViewById(R.id.rl_wxfw);
        rlWxfw.setOnClickListener(CustomerserviceActivity.this);
    }

    @OnClick({R.id.rl_wxgzh, R.id.rl_wxfw})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.rl_xl:
                break;
            case R.id.rl_wxgzh:
                break;
            case R.id.rl_wxfw:
                break;
        }
    }
}
